home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 403 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: EU.net!sun4nl!ittpub!ittpub!nntp
  2. Newsgroups: comp.lang.c++
  3. Subject: Re: Question about destructor...
  4. Message-ID: <1996Jan4.114938.1727@ittpub>
  5. From: wil@ittpub.nl (Wil Evers)
  6. Date: 4 Jan 96 11:49:38 WET
  7. References: <4ce9mk$atg@eng_ser1.erg.cuhk.hk>
  8. Distribution: world
  9. Nntp-Posting-Host: lintilla
  10.  
  11. In article <4ce9mk$atg@eng_ser1.erg.cuhk.hk> ywleung@cs.cuhk.hk (Marty  
  12. McFly) writes:
  13.  
  14. > Dear All,
  15. >     I now have 2 classes A and B.  B is a derived class of A.
  16. > However, the internal implementation of A is not known, i.e., the
  17. > private members of class A are not provided, only the public members are
  18. > given. 
  19.  
  20. That's interesting. As far as I know, there is no way to derive from a  
  21. class if the compiler can't access its full declaration, including the  
  22. private members. This is one of the more annoying limitations of C++, to  
  23. say the least.
  24.  
  25. > But class B is implemented by myself. So what should be written
  26. > in the destructor of B so that all the private members inherited from A
  27. > are also "deleted"?
  28.  
  29. Nothing. After cleaning up the derived part of the object, a derived  
  30. class's destructor automatically calls the base class destructor.
  31.  
  32. - Wil
  33.